package com.lucenex.core.field;

import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortField.Type;

import lombok.Builder;

/**
 * 排序 sort
 * @author zxw
 *
 */
@Builder
public class FieldSort{
	
	private String[] fields;
	private Type[] types;
	private boolean[] reverses;
	
	public Sort sort() {
		Sort sort = new Sort();
		for(int i=0;i<this.fields.length;i++) {
			sort.setSort(new SortField(fields[i], types[i], reverses[i]));
		}
		return sort;
	}
}
